var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(t, e) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(t, e) {
        t.__proto__ = e;
    } || function(t, e) {
        for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
    })(t, e);
}, function(t, e) {
    function i() {
        this.constructor = t;
    }
    o(t, e), t.prototype = null === e ? Object.create(e) : (i.prototype = e.prototype, 
    new i());
}), a = this && this.__decorate || function(t, e, i, o) {
    var n, s = arguments.length, c = s < 3 ? e : null === o ? o = Object.getOwnPropertyDescriptor(e, i) : o;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) c = Reflect.decorate(t, e, i, o); else for (var r = t.length - 1; 0 <= r; r--) (n = t[r]) && (c = (s < 3 ? n(c) : 3 < s ? n(e, i, c) : n(e, i)) || c);
    return 3 < s && c && Object.defineProperty(e, i, c), c;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("GidePointView"), s = e("BaseView"), c = cc._decorator, l = c.ccclass, d = c.property, u = function(e) {
    function t() {
        var t = null !== e && e.apply(this, arguments) || this;
        return t.gides = [], t.gideView = null, t.gidePrefab = null, t.msg = null, t.mask = null, 
        t.shadow = null, t.events = [], t.count = 0, t.total = 2, t.isShadow = !1, t.arr = [], 
        t;
    }
    return i(t, e), t.prototype.onClickBg = function(t) {
        var e = t.getLocation();
        this.gides.some(function(t) {
            return t.rect.contains(e);
        }) ? this.shadow._touchListener.setSwallowTouches(!1) : (this.shadow._touchListener.setSwallowTouches(!0), 
        this.showMsg(3), this.count++, this.count > this.total && (this.count = 0, this.hidePnl()));
    }, t.prototype.start = function() {
        var t = this;
        this.shadow.on(cc.Node.EventType.TOUCH_START, this.onClickBg, this), this.isShadow && this.mask._graphics && (this.mask._updateGraphics = function() {
            var e = t.mask._graphics;
            e.clear(!1), t.arr.forEach(function(t) {
                e.circle(t.x, t.y, 70);
            }), e.fill();
        }, this.mask._updateGraphics());
    }, t.prototype.init = function(i, t) {
        var o = this;
        for (void 0 === t && (t = !0); this.gides.length < i.length; ) {
            var e = cc.instantiate(this.gidePrefab), n = e.getComponent(r.default);
            n && this.gides.push(n), e.parent = this.gideView;
        }
        this.count = 0, this.arr = [], this.gides.forEach(function(t, e) {
            e < i.length ? (t.enabled = !0, e = i[e], e = cc.v2(o.node.convertToNodeSpaceAR(e)), 
            t.init(e), o.arr.push(e)) : t.enabled = !1, t.node.active = t.enabled;
        }), 1 == i.length ? this.gides.forEach(function(t) {
            t.finger.anchorY = .6;
        }) : this.gides.forEach(function(t) {
            t.finger.anchorY = .8;
        }), this.isShadow = t;
    }, t.prototype.showGide = function(t) {
        void 0 === t && (t = !0), this.gides.forEach(function(t) {
            return t.node.active = t.enabled;
        }), this.mask.node.active = t;
    }, t.prototype.hideGide = function() {
        this.gides.forEach(function(t) {
            return t.node.active = !1;
        }), this.mask.node.active = !1;
    }, t.prototype.stopGide = function() {
        this.gides.forEach(function(t) {
            return cc.Tween.stopAllByTarget(t.node);
        }), this.hideGide(), this.hidePnl();
    }, t.prototype.showCircle = function() {
        this.gides.forEach(function(t) {
            return t.showCircle();
        });
    }, t.prototype.hideCircle = function() {
        this.gides.forEach(function(t) {
            return t.hideCircle();
        });
    }, t.prototype.showMsg = function(i) {
        this.unschedule(this.hideMsg), cc.Tween.stopAllByTarget(this.msg), this.msg.opacity = 255, 
        this.msg.active = !0, this.msg.children.forEach(function(t, e) {
            t.active = e === i;
        }), this.scheduleOnce(this.hideMsg, 1);
    }, t.prototype.hideMsg = function() {
        var t = this;
        this.unschedule(this.hideMsg), cc.Tween.stopAllByTarget(this.msg), this.msg.opacity = 255, 
        cc.tween(this.msg).to(1, {
            opacity: 0
        }).call(function() {
            t.msg.active = !1;
        }).start();
    }, a([ d(cc.Node) ], t.prototype, "gideView", void 0), a([ d(cc.Prefab) ], t.prototype, "gidePrefab", void 0), 
    a([ d(cc.Node) ], t.prototype, "msg", void 0), a([ d(cc.Mask) ], t.prototype, "mask", void 0), 
    a([ d(cc.Node) ], t.prototype, "shadow", void 0), a([ l ], t);
}(s.default);

n.default = u;